package com.zx.tfw.enums;

import java.util.HashMap;
import java.util.Map;

public enum LicenseEnum {

    ApacheV2License(1, "Apache v2 License"),
    AfferoGPL(2, "Affero GPL"),
    ArtisticLicense2(3, "Artistic License 2.0"),
    BSD3ClauseLicense(4, "BSD (3-Clause) License"),
    BSD2ClauseLicense(5, "BSD 2-Clause License"),
    EclipsePublicLicenseV1(6, "Eclipse Public License v1.0"),
    GPLV2(7, "GPL v2"),
    GPLV3(8, "GPL v3"),
    LGPLV3(9, "LGPL v3"),
    MITLicense(10, "MIT License"),
    MozillaPublicLicenseVersion2(11, "Mozilla Public License Version 2.0"),
    OSL3(12, "OSL 3.0"),
    PublicDomain(13, "Public Domain(Unlicense)"),
    WTFPL(14, "WTFPL"),
    Zlib(15, "Zlib");

    private static final Map<Integer, LicenseEnum> map;

    static {
        map = new HashMap<>();
        LicenseEnum[] values = LicenseEnum.values();
        for (LicenseEnum typeEnum : values) {
            map.put(typeEnum.getCode(), typeEnum);
        }
    }

    private int code;
    private String name;

    LicenseEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static Map<Integer, LicenseEnum> asMap() {
        return map;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


}
